<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>后盾人</title>
  </head>
  <body></body>
  <script>
    //收 放
    // let hd = [1, 2, 3];
    // let [a, b, c] = [...hd];
    // console.log(a);
    // console.log([...hd]);
    // let [a, ...edu] = [1, 2, 3, 4];
    // console.log(edu);
    // function sum(...args) {
    //   // console.log(arguments);
    //   console.log(args);
    //   return args.reduce((a, b) => a + b);
    // }
    // console.log(sum(1, 2, 3, 4, 6, 7, 77, 88, 78));
    function sum(discount = 0, ...price) {
      // console.log(price);
      let total = price.reduce((a, b) => a + b);
      // console.log(total);
      return Math.round(total * (1 - discount));
    }
    console.log(sum(0.5, 199, 2900, 877));
  </script>
</html>
